package com.ruoyi.system.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 订单
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum BdmOrderEnum {
    UNPAID(0L,"待支付"),
    SHIPMENTS(1L,"待发货"),
    DISTRIBUTION(2L,"已发货"),
    GATHER(3L,"待收货"),
    ACCOMPLISH(4L,"已完成"),
    CHARGEBACK(5L,"已退单"),
    CLOSE(6L,"已关闭"),
    PARTIAL_REFUND(7L,"退款中"),

    EXIST(0L,"存在"),
    DELETE(1L,"删除"),
    COMMON(1L,"普通配送"),
    URGENT(2L,"加急配送"),
    TIMEOUT(15L,"订单超时时间分钟"),
    BALANCE(1L,"余额"),
    THIRD_PARTY(2L,"第三方"),
    CLOUD_INVENTORY_PICKUP(3L,"云库存提货"),
    ;

    /**
     * 类型
     */
    private Long type;

    /**
     * 描述
     */
    private String description;



    // 静态方法，用于通过code查找对应的枚举实例
    public static BdmOrderEnum findByCode(Long type) {
        for (BdmOrderEnum status : values()) {
            if (status.getType().equals(type)) {
                return status;
            }
        }
        return null;
    }

    // 静态方法，用于通过code查找对应的信息
    public static String getTypeName(Long type) {
        BdmOrderEnum code = findByCode(type);
        return code != null ? code.getDescription() : "";
    }
}
